App({
  onLaunch: function () {
    wx.login({
      success: res => {
      }
    })
    wx.getSetting({
      success: res => {
        if (res.authSetting['scope.userInfo']) {
          this.getUserInfo()
        }else{
          wx.authorize({
            scope: 'scope.userInfo',
            success: this.getUserInfo
          })
        }
      }
    })
  },
  getUserInfo: function(){
    wx.getUserInfo({
      success: res => {
        this.globalData.userInfo = res.userInfo
        if (this.userInfoReadyCallback) {
          this.userInfoReadyCallback(res)
        }
      }
    })
  },
  globalData: {
    userInfo: null,
    g_isPlayingMusic: false,
    g_currentMusicPostId: null,
    doubanBase: "http://t.yushu.im"
  }
})